﻿using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class OptionContent_Option : OptionContent {
    public Dictionary<int, OptionContent> content = new Dictionary<int, OptionContent>();
    public delegate void OnAddOneContent(OptionContent_String content_II);
    public event OnAddOneContent onAddOneContent;
    int maxIndex = 0;

    /// <summary>
    /// 读取课程时使用此方法
    /// </summary>
    /// <param name="newContent"></param>
    public void AddOneContent(OptionContent_String newContent)
    {
        newContent.myOption = this;
        content.Add(newContent.number, newContent);
        if (onAddOneContent != null)
        {
            onAddOneContent(newContent);
        }
    }
    /// <summary>
    /// 创建一个新的选项
    /// </summary>
    /// <returns></returns>
    public OptionContent_String AddOneContent()
    {
        maxIndex++;
        OptionContent_String O_II = new OptionContent_String();
        O_II.myOption = this;
        O_II.number = maxIndex;
        content.Add(maxIndex, O_II);
        if (onAddOneContent != null)
        {
            onAddOneContent(O_II);
        }
        return O_II;
    }
}
